package com.jy.modules.cims.component.common.service;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jy.modules.cims.data.common.dao.TCMmCostParamDao;
import com.jy.modules.cims.data.common.dto.TCMmCostParamDTO;
import com.jy.platform.core.common.BaseDTO;

/**
 * @classname: TCMmCostParamService
 * @description: 定义  费用参数 实现类
 * @author:  JY-IT-D001
 */
@Service("com.jy.modules.platform.tcmmcostparam.service.TCMmCostParamService")
public class TCMmCostParamService implements Serializable {

    private static final long serialVersionUID = 1L;
    
	@Autowired
	private TCMmCostParamDao dao;

	/**
     * @author JY-IT-D001
     * @description: 分页查询 费用参数列表
     * @date 2016-04-05 14:42:14
     * @param searchParams 条件
     * @return
     * @throws
     */ 
	public List<TCMmCostParamDTO> searchTCMmCostParamByPaging(Map<String,Object> searchParams) throws Exception {
		List<TCMmCostParamDTO> dataList =  dao.searchTCMmCostParamByPaging(searchParams);
		return dataList;
	}
	/**
     * @author JY-IT-D001
     * @description: 按条件查询费用参数列表
     * @date 2016-04-05 14:42:14
     * @param searchParams 条件
     * @return
     * @throws
     */
	public List<TCMmCostParamDTO> searchTCMmCostParam(Map<String,Object> searchParams) throws Exception {
	    List<TCMmCostParamDTO> dataList = dao.searchTCMmCostParam(searchParams);
        return dataList;
    }
	/**
     * @author JY-IT-D001
     * @description: 查询费用参数对象
     * @date 2016-04-05 14:42:14
     * @param id
     * @return
     * @throws
     */ 
	public TCMmCostParamDTO queryTCMmCostParamByPrimaryKey(String id) throws Exception {
		
		TCMmCostParamDTO dto = dao.findTCMmCostParamByPrimaryKey(id);
		
		if(dto == null) dto = new TCMmCostParamDTO();
		
		return dto;
		
	}

	/**
     * @title: insertTCMmCostParam
     * @author JY-IT-D001
     * @description: 新增 费用参数对象
     * @date 2016-04-05 14:42:14
     * @param dto
     * @return
     * @throws
     */
	@SuppressWarnings("all")
	public Long insertTCMmCostParam(TCMmCostParamDTO dto) throws Exception {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", dto);
		
		int count = dao.insertTCMmCostParam(paramMap);
		
		TCMmCostParamDTO resultDto = (TCMmCostParamDTO) paramMap.get("dto");
		Long keyId = resultDto.getId();
		return keyId;
	}
	/**
     * @title: updateTCMmCostParam
     * @author JY-IT-D001
     * @description: 修改 费用参数对象
     * @date 2016-04-05 14:42:14
     * @param paramMap
     * @return
     * @throws
     */
	public void updateTCMmCostParam(TCMmCostParamDTO dto) throws Exception {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", dto);
		
		dao.updateTCMmCostParam(paramMap);
	}
	/**
     * @title: deleteTCMmCostParamByPrimaryKey
     * @author JY-IT-D001
     * @description: 删除 费用参数,按主键
     * @date 2016-04-05 14:42:14
     * @param paramMap
     * @throws
     */ 
	public void deleteTCMmCostParamByPrimaryKey(BaseDTO baseDto,String ids) throws Exception {
		if(StringUtils.isEmpty(ids)) throw new Exception("删除失败！传入的参数主键为null");
		
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", baseDto);
		paramMap.put("ids", ids);
		dao.deleteTCMmCostParamByPrimaryKey(paramMap);
	}

	public void calcFeeLoanService(){
		
	}
}

